package thinkingJava.chapter09;

import java.util.Arrays;

public abstract class StringProcesser implements IProcesser {
	public String name() {
		return getClass().getSimpleName();
	}
	public abstract Object process(Object input);
	public static String s = "Past this life to ShangDong Weifang Station!";
	public static void main(String[] args) {
		MyApply.process(new UpCase(), s);
		MyApply.process(new DownCase(), s);
		MyApply.process(new Spliter(), s);
	}
}
class UpCase extends StringProcesser {
	public String process(Object input) {
		return ((String)input).toUpperCase();
	}
}
class DownCase extends StringProcesser {
	public String process(Object input) {
		return ((String)input).toLowerCase();
	}
}
class Spliter extends StringProcesser {
	public String process(Object input) {
		return Arrays.toString(((String)input).split(" "));
	}
}
class MyApply {
	public static void process(StringProcesser p,Object s) {
		System.out.println(p.process(s));
	}
}

